home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12586 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.4 KB  |  57 lines

  1. Newsgroups: comp.lang.c,comp.lang.c++
  2. Path: news.sprintlink.net!news1!ind-004-236-178
  3. From: dlmiller@iquest.net (Doug Miller)
  4. Subject: Re: Statistically Random Number algorithm
  5. X-Nntp-Posting-Host: ind-004-236-178.iquest.net
  6. Message-ID: <DoJADr.I48@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Network Services
  9. X-Newsreader: News Xpress Version 1.0 Beta #2.1
  10. References: <314D0B67.3C16@psu.edu> <4in2ao$5ee@newserv.agcs.com>
  11. Date: Tue, 19 Mar 1996 21:32:04 GMT
  12.  
  13. "George B. T. Greene" <greeneg@agcs.com> wrote:
  14. +Xref: news1 comp.lang.c:71054 comp.lang.c++:88917
  15. +Path: news1!news.sprintlink.net!newserv.agcs.com!news
  16. +From: "George B. T. Greene" <greeneg@agcs.com>
  17. +Newsgroups: comp.lang.c,comp.lang.c++
  18. +Subject: Re: Statistically Random Number algorithm
  19. +Date: 19 Mar 1996 19:35:52 GMT
  20. +Organization: AG Communication Systems, ITS
  21. +Lines: 26
  22. +Message-ID: <4in2ao$5ee@newserv.agcs.com>
  23. +References: <314D0B67.3C16@psu.edu>
  24. +NNTP-Posting-Host: greeneg.agcs.com
  25. +Mime-Version: 1.0
  26. +Content-Type: text/plain; charset=us-ascii
  27. +Content-Transfer-Encoding: 7bit
  28. +X-Mailer: Mozilla 1.2N (Windows; I; 32bit)
  29. +
  30. +Whew!
  31. +
  32. +"Jason A. Soloff" <jas251@psu.edu> wrote:
  33. +>
  34. +>I am working on a monte carlo simulation program to model some problems
  35. +>in astronomy.  One thing I am running into, however, is the problem of
  36. +>the pseudo-random number tables.  Does anyone have an algorithm (or
  37. +>code) for a truly statistically random number generator?
  38. +
  39. +This is not exactly a trivial question.  I'd suggest for a start getting a
  40. +copy of Donald Knuth's "The Art of Computer Programming"  volume 2:
  41. +"Seminumerical Algorithms," and reading chapter 3.  You'll learn a lot
  42. +about what it takes to make a (pseudo)-random number sequence "good" in
  43. +some sense, and how to test the result of any effort in that direction.
  44. +Check out his "algorithm M" in particular.  However, please note that the
  45. +chapter starts with a quote from John von Neumann:  "Anyone who considers
  46. +arithmetical methods of producing random number digits is, of course, in a
  47. +state of sin."
  48. +
  49. +You should also give some thought as to how you are going to use the
  50. +numbers.  For example, if you use them in pairs, or n-tuples generally,
  51. +you'd want to check the distribution of the tuples.  (I can imagine your
  52. +project as generating simulated star fields, in which case you might be
  53. +generating position coordinate pairs for individual stars.)
  54. +
  55. +
  56. I believe that Robert Sedgwick's book "Algorithms in C" has some examples.
  57.